const bitsharesjs = require("bitsharesjs/dist");
const ops = bitsharesjs.ops
const hash = bitsharesjs.hash;

function getTxIdFromTransaction(trans){
    var buf2 = ops.transaction.toBuffer(trans)
    var txid = hash.sha256(buf2).toString('hex').substring(0, 40);
    return txid
}

module.exports = {
    getTxId:getTxIdFromTransaction
}